/*
 * DrawDialog.java
 */

package othello.gui;

//Imports
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class DrawDialog extends JDialog implements ActionListener{
    
    private JButton okButton = new JButton("OK");
    private ImageIcon image = new ImageIcon(getClass().getClassLoader().getResource("img/tie.jpg"));
    private JLabel label = new JLabel(image);
    private JPanel panel = new JPanel();
    private JPanel buttonPanel = new JPanel();
    private FlowLayout flw = new FlowLayout();
    
    
    public DrawDialog(Frame owner) {
       
        super(owner);
        
        this.setTitle("It's a tie!");
        
        this.getContentPane().setBackground(new Color(0x762426));
        this.getContentPane().add(label,BorderLayout.NORTH);
        this.getContentPane().add(panel,BorderLayout.CENTER);
        
        buttonPanel.add(okButton);
        this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
        okButton.addActionListener(this);
        buttonPanel.setBackground(new Color(0x762426));
        
        panel.setLayout(flw);
        
        this.setSize(250, 420);
        this.setLocationRelativeTo(owner);
        this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setVisible(true);
    }

    //Closes the fram, when OK is clicked.
    public void actionPerformed(ActionEvent e) {
        dispose();
    }
}